/**
 * 
 */
package com.pine.sunshineelder.checkin.vo.elder;

import java.util.ArrayList;
import java.util.List;

import com.pine.sunshineelder.common.entity.ElderEntity;
import com.pine.sunshineelder.common.entity.RelativeEntity;

import lombok.Data;

/**
 * @author 苟瑞雪
 *
 */
@Data
public class ElderRelationVo {
	private String id;
	private String elderName;
	private String name;
	private Integer male;
    private String idCard;
    private String relation;
    private String workPhone;
    private String privatePhone;
    private String email;
    private String address;
    private String wechat;
    public static List<ElderRelationVo> of(ElderEntity ee) {
    	List<ElderRelationVo> evs=new ArrayList<ElderRelationVo>();
    	List<RelativeEntity> res=ee.getRelatives();
    	  for(RelativeEntity re:res) {
    		  ElderRelationVo er=new ElderRelationVo();
    		  er.setElderName(ee.getName());
    		  er.setId(re.getId());
    		  er.setName(re.getName());
    		  if(ee.isMale()) {
    				er.setMale(1);
    			}else {
    				er.setMale(0);
    			}
    		  er.setIdCard(re.getIdCard());
    		  er.setRelation(re.getRelation());
    		  er.setWorkPhone(re.getWorkPhone());
    		  er.setPrivatePhone(re.getPrivatePhone());
    		  er.setEmail(re.getEmail());
    		  er.setAddress(re.getAddress());
    		  er.setWechat(re.getWechat());
    		  evs.add(er);
    	  }
		return evs;
    	
    }
}
